Generate a Click-to-call authentication code

This endpoint generates a short-lived authentication code for a Click-to-call SIP connection. Your backend application calls this endpoint and passes the code to the Click-to-call widget. The widget uses the code to authenticate a single call. For more information, see Secure Click-to-call with authentication codes.

Endpoint

POST /api/v1/sipConnections/{sipConnectionId}/generateAuthenticationCode

Path parameters

Parameter Type Description
sipConnectionId string ID of the Click-to-call SIP connection.

Body

Field Type Description
callerPhone string Optional. Asserts the identity of the caller. Must be in E.164 format. Without it, the caller's phone number is not validated.

Request

POST /api/v1/sipConnections/f399069f-e84f-41e4-ac71-fab2ded73f1c/generateAuthenticationCode HTTP/1.1
Host: livehub.audiocodes.io
Content-Type: application/json
Authorization: Bearer {token}

{
  "callerPhone": "+123456789"
}

Response

Field Type Description
authenticationCode string The generated code. It is valid for one minute and can be used only once.
{
  "authenticationCode": "LHv1_8e22ba993a094a85af5b3d9fd2c87f2a"
}
Code Meaning
200 OK The code was generated.
400 Bad Request The request was invalid.
401 Unauthorized The access token is invalid or expired.
404 Not Found No SIP connection with that ID.

Call this endpoint from your backend application only. Do not call it from client-side code. This endpoint requires a Live Hub access token, and you must not expose the token to the browser.